package com.example.newsapp.viewmodel;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;
import com.example.newsapp.model.entity.NewsData;
import com.example.newsapp.model.repository.NewsRepository;

public class NewsViewModel extends ViewModel {
    private NewsRepository repository;
    private LiveData<NewsData> newsData;
    private LiveData<String> errorMessage;

    public NewsViewModel() {
        repository = new NewsRepository();
        newsData = repository.getNewsData();
        errorMessage = repository.getErrorMessage();
    }

    public void getNewsList(String city, int page) {
        repository.getNewsList(city, page);
    }

    public LiveData<NewsData> getNewsData() {
        return newsData;
    }

    public LiveData<String> getErrorMessage() {
        return errorMessage;
    }
}